package org.cnc.core;

import java.io.Serializable;

	@SuppressWarnings("serial")
	public class DetailModel implements Serializable {
		
		public enum ModelState {
			EMPTY, DETAIL, CUTTER, CUTTED
		}
		
		/**
		 * 
		 */
		//private static final long serialVersionUID = 1L;
		
		public int detailSize;

		public int canvasSize;
		
		public ModelState[][][] detailModel;
		
		public int getModelSize() {
			return canvasSize;
		}
		
		public int getDetailSize() {
			return detailSize;
		}
		
		public DetailModel( int size, int canvas_size )
		{
			canvasSize = canvas_size;
			detailSize = size;
			
			detailModel = new ModelState[canvas_size][canvas_size][canvas_size];
			
			clearModel( );
		}
		
		private void clearModel( )
		{
			int border_first = (canvasSize - detailSize)/2;
			int border_last = detailSize + border_first;
			
			for ( int x = 0; x < canvasSize; x ++ )
			{
				for ( int y = 0; y < canvasSize; y++ )
				{
					for ( int z = 0; z < canvasSize; z ++)
					{
						
						if ( y >= 0 && y < detailSize && z >= border_first && z < border_last && x < border_last && x >= border_first )
						{
							detailModel[x][y][z] = ModelState.DETAIL;
						}
						else
							detailModel[x][y][z] = ModelState.EMPTY;
					}
				}
			}
		}
		
	}